//姓名脱敏
function nameDesensitize(name) {
    if (!name) return ""
    if (name.length === 2) return name.charAt(0) + "*"

    const firstChar = name.charAt(0);
    const lastChar = name.charAt(name.length - 1);
    // 计算中间需要替换的星号数量  
    const stars = Array(name.length - 2).fill('*').join('');

    return firstChar + stars + lastChar;
}
export default nameDesensitize